<template>
	<view class="dangyuanxuexi-page">
		<view  class="flex flex-column bgcolor1 border-bottom p-2 msgitem"
			v-for="(item,index) in dataList"  
			:key="index"  
			@click="navTo(item)">
			<view  class="flex align-center">
				<image style="width: 20px;height: 20px;" src="/static/images/wz_icon.png" mode="widthFix"></image>
				<text class="fs-28 ftcolor1 ml-1" v-if="item.department">{{item.department.name}}</text>
				<text class="fs-24 ftcolor4 px-2 py-1" v-if="item.regions">{{item.regions.name}}</text>
			</view>
			<view class="fs-32 ftcolor1 my-1">{{item.title}}</view>
			<view class="ftcolor4 fs-24">{{item.created_at}}</view>
		</view>
		<view class="text-center py-3" v-if="this.tempList.length === 15"><text class="fs-24 ftcolor2"
				@click="clickMore">查看更多</text></view>
		<noneBox v-if="dataList.length === 0"></noneBox>
	</view>
</template>

<script>
	import serviceApi from '@/api/serviceApi.js'
	export default {
		data() {
			return {
				dataList:[],
				tempList:[],
				page:1,
			}
		},
		created() {
			this.gz_dyxx()
		},
		methods: {
			gz_dyxx(){
				serviceApi.gz_dyxx({page:this.page,limit:15}).then(res =>{
					this.tempList = res.data
					if (this.page === 1) {
						this.dataList = res.data
					} else {
						this.dataList = this.dataList.concat(res.data)
					}
				})
			},
			clickMore() {
				if (this.tempList.length === 15) {
					this.page++
					this.gz_dyxx()
				}
			},
			navTo(item){
				uni.setStorageSync('curservicedetails',item)
				uni.navigateTo({
					url:'/pages/service/details?title=党员学习'
				})
			},
		}
	}
</script>

<style lang="scss">
.dangyuanxuexi-page{
	
}
</style>
